package com.zhl.recursion2;

public class RecursionTest2 {
    public static void main(String[] args) {
        //目标：猴子吃桃问题
        //f(10) = 1
        //公式 f(x) - f(x)/2 -1 = f(x+1)
        //变形   f(x) = 2f(x+1) + 2
        //求f(1)
        System.out.println(eat(1));
    }
    public static int eat(int n){
        if(n==10){
            return 1;
        }else{
            return 2*eat(n+1) + 2;
        }
    }

}
